﻿<UserControl 
    x:Class="PersianEditor.UserControls.TexturesManagerUC"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d" 
    d:DesignWidth="300"
    d:DesignHeight="500">
    <UserControl.Resources>
        <DataTemplate x:Key="DTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Image
                    Grid.Column="0"
                    Width="32" 
                    Height="32" 
                    Source="{Binding TexturePath}"
                    Stretch="Fill"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Center">
                </Image>
                <TextBlock
                    Grid.Column="1"
                    Text="{Binding Name}"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Left"
                    Margin="5,5"
                    Foreground="White"
                    Tag="{Binding MeshName}">
                </TextBlock>
                <telerik:RadButton                    
                    Grid.Column="2"
                    Content="..."
                    VerticalAlignment="Center"
                    HorizontalAlignment="Right"
                    CornerRadius="5"
                    Margin="5,5"
                    Width="30"
                    Click="BrowseClick">
                </telerik:RadButton>
            </Grid>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="HTemplate" 
            ItemsSource="{Binding Products}"
            ItemTemplate="{StaticResource DTemplate}">
            <TextBlock 
                Text="{Binding Name}">
            </TextBlock>
        </HierarchicalDataTemplate>
    </UserControl.Resources>
    <Grid>
        <telerikQuickStart:HeaderedContentControl 
            HorizontalContentAlignment="Stretch" 
            VerticalContentAlignment="Stretch"
            telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"
            Header="Textures of Meshes"> 
            <telerik:RadTreeView x:Name="treeView"
				ItemTemplate="{StaticResource HTemplate}"
				IsLoadOnDemandEnabled="True">
            </telerik:RadTreeView>
        </telerikQuickStart:HeaderedContentControl>
    </Grid>
</UserControl>